package com.stylefeng.guns.modular.flagglory.service.impl;

import com.stylefeng.guns.common.persistence.model.Book;
import com.stylefeng.guns.common.persistence.dao.BookMapper;
import com.stylefeng.guns.modular.flagglory.dao.BookDao;
import com.stylefeng.guns.modular.flagglory.service.IBookService;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author stylefeng123
 * @since 2018-02-05
 */
@Service
@Transactional(rollbackFor = Exception.class)
public class BookServiceImpl extends ServiceImpl<BookMapper, Book> implements IBookService {
    @Autowired
    private BookDao bookDao;

    @Override
    public List<Map<String, Object>> selectChaptersByBookId(Integer bookId) {
        return bookDao.selectChaptersByBookId(bookId);
    }

    @Override
    public Map<String, Object> selectNextOrBeforeChapter(Boolean isNext,Integer sort,Integer bookId) {
        return bookDao.selectNextOrBeforeChapter(isNext,sort,bookId);
    }
}
